﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace ElingOA6_Admin_DSJCJ.BLL
{
    /// <summary>
    ///PaperAnswer业务逻辑简要说明。 
    /// </summary>
    public class PaperAnswer
    {
        /// <summary>
        /// 组织机构DAL
        /// </summary>
        private readonly ElingOA6_Admin_DSJCJ.DAL.PaperAnswer dal = new ElingOA6_Admin_DSJCJ.DAL.PaperAnswer();
        /// <summary>
        /// 构造函数
        /// </summary>
        public PaperAnswer()
        { }


        /// <summary>
        /// 判断某个题目是否已存在答题
        /// </summary>
        /// <creator>chenly</creator>
        /// <date>2013-7-25</date>
        /// <param name="paperTopicId">主题编号</param>
        /// <returns>是否存在</returns>
        public bool ExistsByTopicID(decimal paperTopicId)
        {
            return dal.ExistsByTopicID(paperTopicId);
        }

        /// <summary>
        /// 获取题目编号组中存在已有答题的题目编号
        /// </summary>
        /// <creator>chenly</creator>
        /// <date>2013-7-25</date>
        /// <param name="paperTopicIDs">主题编号</param>
        /// <returns>list集合</returns>
        public List<decimal> GetAnswerExistsByTopicIDS(string paperTopicIDs)
        {
            DataSet ds = dal.GetAnswerExistsByTopicIDS(paperTopicIDs);
            List<decimal> list = new List<decimal>();
            foreach (DataRow row in ds.Tables[0].Rows)
            {
                list.Add(decimal.Parse(row["FPaperTopicId"].ToString()));
            }

            return list;
        }
    }
}
